<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>防止重叠</title>
    <style>
        .one{
            width:400px;
            height:400px;
            background: #999999;
            overflow: hidden;
        }
        .two{
            width:100%;
            height:100px;
            background: deeppink;
            margin:20px 0;
        }
        .wrap{
            overflow: hidden;
        }
        h2{
            margin-top: 60px;
        }
    </style>
</head>
<body>
<h3>这个 两个的margin重叠了</h3>
    <div class="one">
        <div class="two">1</div>
        <div class="two">2</div>
    </div>

<h2>这个没有重叠</h2>
<div class="one">
    <div class="wrap">
        <div class="two">1</div>
    </div>
    <div class="two">2</div>
</div>
</body>
</html>
